package com.itheima.patterns.builderpattern.singleton.lazyman3;

public class Singleton {
    
    //私有构造方法
    public Singleton() {

    }
    
    //静态内部类
    public static class SingletonHolder {
        private static final Singleton INSTANCE = new Singleton();
    }
    
    //对外提供静态方法获取该对象
    public static Singleton getInstance() {
        return SingletonHolder.INSTANCE;
    }

    public static void main(String[] args) {
        Singleton instance1 = getInstance();
        Singleton instance2 = getInstance();
        System.out.println(instance1 == instance2);
    }
}